extends layout

block content

  h1 #{title}: #{book.title}
  
  p #[strong Author:] 
    a(href=book.author.url) #{book.author.name}
  p #[strong Summary:] #{book.summary}
  p #[strong ISBN:] #{book.isbn}
  p #[strong Genre:] 
    each val in book.genre
      a(href=val.url) #{val.name}
      |, 

  hr
  
  if book_instances.length
  
    p #[strong Delete the following copies before attempting to delete this Book.]
  
    div(style='margin-left:20px;margin-top:20px')

      h4 Copies
    
        each book_copy in book_instances
          hr
          if book_copy.status=='Available'
            p.text-success #{book_copy.status}
          else if book_copy.status=='Maintenance'
            p.text-danger #{book_copy.status}
          else
            p.text-warning #{book_copy.status} 
          p #[strong Imprint:] #{book_copy.imprint}
          if book_copy.status!='Available'
            p #[strong Due back:] #{book_copy.due_back}
          p #[strong Id:] 
            a(href=book_copy.url) #{book_copy._id}

  else
    p Do you really want to delete this Book?
    
    form(method='POST' action='')
      div.form-group
        input#id.form-control(type='hidden',name='id', required='true', value=book._id )

      button.btn.btn-primary(type='submit') Delete